package com.woniuxy.warehouse.controller;


import com.alibaba.excel.EasyExcel;
import com.woniuxy.commons.entity.warehouse.dto.StockInHomePageDto;
import com.woniuxy.commons.entity.warehouse.dto.TimeAndOrderDto;
import com.woniuxy.commons.result.Result;
import com.woniuxy.warehouse.service.StockInHomePageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * @Author:SHEAndme
 * @Todo:TODO
 * @DateTime:2022/4/25 14:12
 * @Component:霍格沃兹魔法学院
 **/
@RestController
@RequestMapping("/warehouse/StockInHomePage")
public class StockInHomePageController {
    @Resource
    private StockInHomePageService stockInHomePageService;

    @ApiOperation(value = "入库单主页")
    @PostMapping("/findAllStockInHomePage/{pageNum}/{pageSize}")
    public Result findAllStockInHomePage(@PathVariable("pageNum") Integer currentPage,
                                        @PathVariable("pageSize") Integer pageSize,
                                        @RequestBody TimeAndOrderDto timeAndOrderDto){

        return  stockInHomePageService.findAllStockInHomePage(currentPage,pageSize,timeAndOrderDto);
    }
/**
 * @description TODO 尝试导出数据
 */


@ApiOperation(value = "入库单主页")
@PostMapping("/exportStockInHomePage")
public void exportStockInHomePage( @RequestBody TimeAndOrderDto timeAndOrderDto){
//    String fileName = "入库管理"+timeAndOrderDto.getIoOrderNo()+".xlsx";
//    EasyExcel.write(fileName, StockInHomePageDto.class).sheet("模板").doWrite(data());
//}
//
//    private List<StockInHomePageDto> data() {
//       return   stockInHomePageService.findAll(TimeAndOrderDto timeAndOrderDto);
    }
}
